import { createRouter, createWebHistory } from "vue-router"

import TopBar from "../components/topBar/index.vue"
import FooterBar from "../components/footerBar/index.vue"

export default createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      name: 'home',
      meta: {
        title: '首页',
        isAuth: false,
      },
      components: {
        default: import("../views/Home"),
        TopBar: <TopBar type="home" buttonAuth="default" />,
        FooterBar
      }
    },
    {
      path: '/editor',
      name: 'editor',
      meta: {
        title: '创建作品',
        isAuth: true,
      },
      components: {
        default: () => import("../views/Editor"),
        TopBar: <TopBar type="editor" buttonAuth="editor" />,
      }
    },
    {
      path: '/myWork',
      name: 'myWork',
      meta: {
        title: '我的作品',
        isAuth: true,
      },
      components: {
        default: () => import("../views/MyWork"),
        TopBar: <TopBar type="myWork" buttonAuth="default" />,
        FooterBar
      }
    },
    {
      path: '/mySetting',
      name: 'mySetting',
      meta: {
        title: '个人中心',
        isAuth: true,
      },
      components: {
        default: () => import("../views/MySetting"),
        TopBar: <TopBar type="mySetting" buttonAuth="default" />,
        FooterBar
      }
    },
    {
      path: '/login',
      name: 'login',
      meta: {
        title: '登陆',
        isAuth: false,
      },
      components: {
        default: () => import("../views/Login")
      }
    }
    // {
    //   path: '/about',
    //   name: 'about',
    //   component: () => import("../views/About")
    // }
  ]
})
